<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
</head>
<body>
<div id="app" >
    <button @click="queryUser">查询</button>
    <ul v-for="(item,index) in list">
        <li>{{index+1}}.姓名：{{item.name}}，年龄：{{item.age}}</li>
    </ul>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
    var app=new Vue({
        el:"#app",
        data:{
            list:[],
            inputValue:""
        },
        methods:{
            queryUser:function () {
                var that=this;
                axios.get("http://localhost:8080/ssh2/getUser").then(function(response){
                        that.list=response.data;
                    }
                ).catch(function(error) {
                    console.log(error);
                })
            }
        },
    })
</script>
</body>
</html>